﻿<UserControl x:Class="WpfTwitterClient.AccountView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:WpfTwitterClient.Modules.Authorization" xmlns:Infrastructure="clr-namespace:WpfTwitterClient.Infrastructure;assembly=WpfTwitterClient.Infrastructure" DataContext="{Binding RelativeSource={RelativeSource Self}}">
    <UserControl.CommandBindings>
        <CommandBinding Command="Save" CanExecute="CommandBinding_CanExecute"
                         Executed="CommandBinding_Executed"></CommandBinding>
    </UserControl.CommandBindings>
    <DockPanel Name="dockPanel1">            
        <StackPanel Margin="20,0">
            <TextBlock Margin="20">1. Please login to twitter:</TextBlock>
            <Image Name="image1" Source="..\..\Images\TwitterSignIn.png" Stretch="Uniform" 
                   HorizontalAlignment="Center" StretchDirection="Both" Width="151" Height="24" ClipToBounds="False" 
                   SnapsToDevicePixels="True" MinWidth="151" MinHeight="24" Cursor="Hand" MouseLeftButtonDown="image1_MouseLeftButtonDown">
            </Image>
            <TextBlock Margin="20">2. Enter the PIN code provided by Twitter:</TextBlock>


            <TextBox Name="txtPin" Width="170px">
                <TextBox.Text>
                    <Binding Path="Pin" Mode="OneWayToSource" 
                               UpdateSourceTrigger="PropertyChanged" ValidatesOnExceptions="True">
                        <Binding.ValidationRules>
                            <local:TwitterPinValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>

            <Button Height="23" Command="Save" Margin="20" Width="75">Save</Button>
            <Separator/>
            <Button Height="23" Command="Infrastructure:InfrastructureCommands.ApplicationResetCommand" Margin="20" Width="75">Reset</Button>

        </StackPanel>
    </DockPanel>

</UserControl>
